﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;

namespace ElevateThis
{
    /// <summary>
    /// This class outputs diagnostic information in a debug build
    /// </summary>
    public static class Diagnostics
    {
        /// <summary>
        /// Header when application first runs
        /// </summary>
        public static void OutputHeader(string[] args)
        {
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("-----------------------------------------------------------");
            Console.WriteLine();
            Console.WriteLine("Process ID:        '{0}'", Process.GetCurrentProcess().Id);
            Console.WriteLine("Command line:      '{0}'", String.Join(" ", args));
            Console.WriteLine("Current directory: '{0}'", Directory.GetCurrentDirectory());
#endif
        }

        /// <summary>
        /// Parsed options
        /// </summary>
        public static void OutputOptions(Options options)
        {
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("Batch file:        '{0}'", options.BatchFile);
            Console.WriteLine("Argument list:     '{0}'", options.ArgumentList);
            Console.WriteLine("Working directory: '{0}'", options.WorkingDir);
            Console.WriteLine("Launch state:      '{0}'", options.LaunchState);
#endif
        }
        
        /// <summary>
                 /// Display information about a newly launched process
                 /// </summary>
        internal static void ShowLaunchedProcess(Process newProc)
        {
#if DEBUG
            Console.WriteLine("Launching process with ID:         '{0}'", newProc.Id);
#endif
        }

        /// <summary>
        /// Final operation before process exits
        /// </summary>
        public static void HandleProcessExit(ExitCode ret)
        {
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("Process {0} will exit with code: '{1}'", Process.GetCurrentProcess().Id, ret);
            Console.Write("Press RETURN> ");
            Console.ReadLine();
#endif
        }
    }
}
